<template>
    <div>
      <i-frame :src="dragUrl"></i-frame>
    </div>
  </template>
  <script>
  import { getToken } from "@/utils/auth";
  import iFrame from "@/components/iFrame/index";
  export default {
    name: "PyJeecgDragView",
    components: { iFrame },
    data() {
      return {
        dragUrl: ""
      }
    },
    created() {
      let query = this.$route.query;
      let code = undefined;
      let paramsString = "";
      if (query) {
        for (const key in query) {
          if (Object.hasOwnProperty.call(query, key)) {
            const param = query[key];
            if (key == "code") {
              code = param;
            } else {
              if (paramsString != "") {
                paramsString += paramsString + "&" + key + "=" + param;
              } else {
                paramsString = "&" + key + "=" + param;
              }
            }
   
          }
        }
      }
   
      if (code) {
        this.dragUrl = process.env.VUE_APP_BASE_API + "/drag/share/view/" + code + "?token=Bearer " + getToken() + paramsString;
   
      } else {
        this.$modal.msgError("大屏编码(code)为空，无法打开大屏");
      }
    }
  }
  </script>
   